<template>
	<view>
		<view class="top-box">
			<image style="width: 100%;height: 311rpx;position: absolute;" src="https://syxiyi.oss-cn-shenzhen.aliyuncs.com/frontend/img/yysuccess-top.png"></image>
			<view class="top-text-box">
				<view style="font-size: 36rpx;color: white;font-weight: 600;">预约成功</view>
				<!-- <view style="padding-top: 20rpx;color: white;">请在{{detail.subscribe_time}}准时到达门店</view> -->
			</view>
		</view>

		<view class="cont">
			<image style="width: 690rpx;height: 800rpx;position: absolute;top: 0rpx;" src="https://syxiyi.oss-cn-shenzhen.aliyuncs.com/frontend/img/yysuccess-top-bg.png"></image>
			<view class="cont-text-box">
				<view style="display: flex;align-items: center;" class="top-title">
					<image style="width: 41rpx;height: 38rpx;" src="https://syxiyi.oss-cn-shenzhen.aliyuncs.com/frontend/img/yyshop-logo.png"></image>
					<view style="font-size: 32rpx;color: #323232;padding-left: 10rpx;font-weight: 600;" class="shop-title">
						{{detail.name}}
					</view>
				</view>
				
				<view class="cont-text">
					<view class="cont-list">
						<view class="">订单详情:</view>
						<view class="one-line">{{detail.title}}</view>
					</view>
					<view class="cont-list" style="padding: 30rpx 0;" v-if="detail.is_discount==1">
						<view class="">会员折扣:</view>
						<view class="one-line">{{detail.discount}}折优惠</view>
					</view>
					<view class="cont-list">
						<view class="">订单编号:</view>
						<view class="">{{detail.order_no}}</view>
					</view>
					<view class="cont-list" style="padding: 30rpx 0;">
						<view class="">下单时间:</view>
						<view class="">{{detail.create_at}}</view>
					</view>
				</view>
				
				<view class="cont-text">
					<view class="price-box">
						<view>
							预约金额
						</view>
						<view>
							￥{{detail.total_price}}
						</view>
					</view>
					<view class="price-box-but">
						<view>
							实付金额:￥{{detail.pay_price}}
						</view>
					</view>
				</view>
				
				
			</view>
			
			
		</view>

		<view class="but" @click="cancelYy">
			取消预约
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: ''
			}
		},
		onLoad(options) {
			this.order_id = options.id
			this.getDetail()
		},
		methods:{
			getDetail() {
				this.$ajaxRequest.get(this.baseUrl + 'shop/order/Detail', {
					order_id: this.order_id
				}, true).then(res => {
					if (res.data.code == 200) {
						this.detail = res.data.data
					} else {
						uni.showToast({
							title:res.data.msg,
							icon: 'none'
						})
					}
				})
			},
			cancelYy() {
				let self = this
				uni.showModal({
					title:'您确定要取消该预约吗',
					content:'',
					success(res) {
						if (res.confirm) {
							self.$ajaxRequest.post(self.baseUrl + 'shop/OrderRefund/Apply', {
								order_id: self.order_id,
								type: 1
							}, true).then(res => {
								if (res.data.code == 200) {
									uni.showToast({
										title:'已取消预约',
										icon:'success'
									})
									setTimeout(() => {
										uni.navigateBack({
										delta:1
									})
									}, 1000);
									
									
								} else {
									uni.showToast({
										title:res.data.msg,
										icon:'none'
									})
								}
							})
						}
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #FAFAFA;
	}
	.price-box{
		font-size: 30rpx;
		color: #323232;
		padding-top: 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-right: 66rpx;
	}
	.price-box-but{
		font-size: 30rpx;
		color: #323232;
		font-weight: 600;
		padding-top: 10rpx;
		text-align: right;
		padding-right: 66rpx;
	}
	.top-box {
		position: relative;
	}

	.top-text-box {
		position: relative;
		z-index: 1;
		padding-top: 85rpx;
		padding-left: 60rpx;
	}

	.cont {
		position: relative;
		margin-top: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.cont-text-box {
		width: 690rpx;
		position: relative;
		z-index: 1;
	}

	.top-title {
		padding-top: 75rpx;
		padding-left: 66rpx;
	}
	.cont-text{
		padding-top: 70rpx;
		padding-left: 66rpx;
		box-sizing: border-box;
	}
	.cont-list {
		display: flex;
		font-size: 30rpx;
	}
	.cont-list>view:nth-child(1) {
		color: #A8A8A8;
	}
	.cont-list>view:nth-child(2) {
		width: 390rpx;
		padding-left: 47rpx;
	}
	.shop-title{
		width: 400rpx;
		overflow:hidden;
		text-overflow:ellipsis;
		white-space:nowrap;
	}
	.but{
		color: #7B7B7B;
		font-size: 26rpx;
		left: 50%;
		margin-left: -310rpx;
		position: fixed;
		bottom: 30rpx;
		text-align: center;
		line-height: 90rpx;
		width:620rpx;
		height:90rpx;
		border:2rpx solid rgba(168,168,168,1);
		border-radius:45rpx;
	}
</style>
